package cn.xsw.controller;

import cn.xsw.common.ResultBody;
import cn.xsw.entity.Company;
import cn.xsw.entity.Business;
import cn.xsw.service.CompanyService;
import cn.xsw.utils.BaseQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangYiHui
 * @since 2021-05-31
 */
@RestController
@RequestMapping("/company")
@Api(tags = "公司详情接口")
public class CompanyController {
    @Resource
    private CompanyService companyService;

    @ApiOperation("根据id更新公司详情")
    @PostMapping("/updateById")
    public ResultBody updateById(@RequestBody Company company){
        Boolean b = companyService.updateById(company);
        if(!b) return ResultBody.error("操作失败");
        return ResultBody.success();
    }
    @ApiOperation("查询公司信息")
    @GetMapping("/findDetail")
    public ResultBody findDetail(){
        List<Company> companyList= companyService.list();
        return ResultBody.success(companyList);

    }
}

